ENVED Environment Editor for DOS Version 1.0 Instructions For Use ------------------------------------------------------------------------- Copyright (c) 1994 Paul M. Parks All Rights Reserved THE AUTHOR, PAUL M. PARKS, DISCLAIMS ALL WARRANTIES RELATING TO THIS SOFTWARE, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHOR OF THIS SOFTWARE WILL NOT BE LIABLE FOR ANY DAMAGES ARISING FROM THE USE OF OR INABILITY TO USE THIS SOFTWARE. MS-DOS and Windows are trademarks of the Microsoft Corporation. OS/2 is a trademark of the IBM Corporation. NDOS is a trademark of the Symantec Corporation. ------------------------------------------------------------------------- -- SHAREWARE LICENSE -- The user is granted one license to use this shareware software for a 30-day evaluation period, beginning at the time of first use, for the express purpose of determining whether or not this software is suitable for the user's purposes. At the end of this 30-day evaluation period, the user must either purchase a license for continued use of the software, or discontinue its use. Any usage beyond this 30-day evaluation period will be a violation of this license. This unregistered copy of ENVED may be freely distributed as long as the files ENVED.EXE, ENVED.TXT, and ENVEDREG.TXT are distributed together and as long as none of these files have been added to, modified, or tampered with in any way. -- INTRODUCTION -- I created ENVED as a means of easily changing environment variables in MS-DOS and making the changes stick once and for all. Often I would change an INCLUDE variable, or make a change to my PATH, and then have to make the change all over again the next time I booted my PC because I had forgotten to update the variable in my AUTOEXEC.BAT file. With ENVED, I make a change once and forget about it. Most users may never have to worry about changing their environment. However, developers, technicians, and good old-fashioned power users often have to very carefully manage environment variables and may frequently need to adjust their values. It is for these users that ENVED is designed. -- HOW TO USE ENVED -- Basic Usage - Changing Variables -------------------------------- Using ENVED is very similar to using the DOS command SET. However, ENVED will make environment variable changes endure even after the computer is turned off by updating the corresponding SET command in AUTOEXEC.BAT. For example, to set the INCLUDE variable, one may type ENVED INCLUDE C:\LANG\INCLUDE;C:\SOURCE\MYPROJ\INCLUDE; (Notice that no equals sign is used, as it is in SET). This command line will set the INCLUDE variable to the value provided, and change any occurrence of SET INCLUDE=somevalue in AUTOEXEC.BAT to SET INCLUDE=C:\LANG\INCLUDE;C:\SOURCE\MYPROJ\INCLUDE; Before ENVED makes any changes to AUTOEXEC.BAT it copies your current file to AUTOEXEC.ENV to preserve your original settings. If a variable has already been assigned a value, but you want to update AUTOEXEC.BAT with that value, you may use the /u option to make the change for you. ENVED /U NEWVAR If the variable NEWVAR is not defined in the environment, ENVED will print a warning to that effect. Adding Variables ---------------- If the AUTOEXEC.BAT file does not have a SET command for the variable you specified on the ENVED command line, one will be added to the file. The first time a variable is added, two comments will be created around the variable. Every subsequent addition will be made inside these two comments. For example, if you were to add the TEMP variable to your AUTOEXEC.BAT file with the value C:\TMP, and you had never added a variable to your batch file with ENVED before, you would see the following lines at the end of AUTOEXEC.BAT: rem ENVED_SET_START SET TEMP=C:\TMP rem ENVED_SET_END Any variables you add afterwards will be inserted just before the ENVED_SET_END remark line. This can be useful in a couple of ways. First, if you like to keep all of your environment variable definitions in one place (a good idea), you can enclose this section of your AUTOEXEC.BAT file in the above comments. Then, anytime you add a variable you can be sure that it is in the proper place. Second, if you are using a boot-up menu to manage different configurations in your AUTOEXEC.BAT, you can have more than one block of SET statements enclosed by these remark lines. If you add any new variables, they will be inserted into each block found in the file. Please remember that the case of the remark lines is not important, and that both remark lines must be present and in order before ENVED will recognize the block. These remarks do not affect the modification of existing SET statements outside of the markers. ENVED will always search the entire AUTOEXEC.BAT file for a variable and modify each occurrence. Removing Variables ------------------ Two methods may be used to remove a variable. One is by using the /x option to delete the variable from the environment and delete its reference in AUTOEXEC.BAT. Another method is to use the /r option, which only remarks the SET command in AUTOEXEC.BAT, but still removes the variable from the environment. These two options cannot be used together, nor in conjunction with the /u option. Specifying The Boot Drive ------------------------- To change AUTOEXEC.BAT files on drives other than drive C:, use the /d option followed by a drive letter to tell ENVED where to look for your AUTOEXEC.BAT file. For example, if you were booting from floppy drive A: and you wanted to change your PATH variable to "A:\DOS;A:\BIN;A:\;", you would type the following: ENVED /DA PATH A:\DOS;A:\BIN;A:\; This would update A:\AUTOEXEC.BAT with the new path and change your environment copy of PATH to the new value. This option may also be used with the /x, /r, and /u options. Assigning Variables to Variables -------------------------------- You may include environment variables in the value section of the ENVED command line (e.g., ENVED USERNAME %USER%). These variables will be evaluated before being written to the environment, but the SET command in AUTOEXEC.BAT will be written with the variable name intact. This way, the value may be evaluated each time AUTOEXEC.BAT is executed. One word of caution is in order, however: make sure that the variable being evaluated on the right-hand side of the SET statement is defined before the variable you are generating is defined. For example, this is correct: SET TOOLINC=C:\COOLTOOL\SRC\INCLUDE SET INCLUDE=C:\LANG\INCLUDE;%TOOLINC%; This results in an incorrect assignment: SET INCLUDE=C:\LANG\INCLUDE;%TOOLINC%; SET TOOLINC=C:\COOLTOOL\SRC\INCLUDE PATH And PROMPT --------------- These variables are unique because they may be assigned either by a SET command or by the DOS commands PATH and PROMPT, respectively. ENVED will sense which method is used to assign these values in AUTOEXEC.BAT and update the file accordingly. -- HOW ENVED WORKS -- The ENVED program changes the DOS environment by creating a temporary batch file that sets the environment variable and then deletes itself. This batch file is run as soon as ENVED stops executing. The reason a batch file is used is that DOS only allows an executable program to modify its own copy of the master environment. As soon as the program ends, any changes made to its environment copy are lost. ENVED gets around this by executing a batch file in the master environment. -- THINGS TO KNOW -- Due to the way ENVED works, there are a some things to be careful about when using it. - Make sure that you have write access to the directory where AUTOEXEC.BAT resides, as well as to AUTOEXEC.BAT itself, since this is where all temporary files are written. You will almost always have such access, but exceptions may exist. - ENVED may perform unpredictably when it is executed from within a batch file, since it stuffs keys into the keyboard buffer to execute the temporary batch file. You may test this, but I recommend making ENVED the last statement of a batch file if it must be executed that way. - ENVED is designed to run under the COMMAND.COM command processor provided with MS-DOS and compatible versions. If you are using a specialized command processor (such as NDOS), you may notice unusual behavior. An example with NDOS is that as soon as the temporary batch file to set the variable is finished executing, NDOS will give an error message that the batch file cannot be found. This is a harmless message, but could be disconcerting if you don't know what it means. It is only generated because the temporary batch file deletes itself after setting the environment. - Running ENVED in a DOS session under Windows or any other similar product will change a variable's value for that DOS session only and not for the master environment. Any DOS session started after the change will reflect the original value of the variable. The AUTOEXEC.BAT file will still be updated, however, so the master environment will reflect the change the next time the computer is booted. - Running ENVED in a DOS session under OS/2 will correctly update AUTOEXEC.BAT as well as that session's environment, but will not affect any other DOS sessions that are already running. Any session started after the change is made will reflect the variable's new value, provided that the session is configured to use AUTOEXEC.BAT as its startup file. PLEASE NOTE: if a DOS session is configured to use a file other than AUTOEXEC.BAT as its startup file, ENVED will still update AUTOEXEC.BAT if it is run from that session. -- TALK TO ME! -- If you have any suggestions, ideas, or gripes please let me know. You can write me at the following address: Paul M. Parks 806 Club Place Duluth, Georgia 30136 If you have access to Internet mail, you may contact me at the following e-mail address: pparks@netcom.com Let me know what you think of ENVED, and tell me if there are any other utilities that would make your life easier, and that you've been waiting for someone to write. I just might be the one to write them for you!